home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++,comp.std.c++
- Path: cs.mu.OZ.AU!bounce-back
- From: jgalt@infosoft.com (John Galt)
- Subject: Re: Name-mangling standard
- Message-ID: <DL1pqE.KKq@infosoft.com>
- Followup-To: comp.lang.c++
- Originator: fjh@munta.cs.mu.OZ.AU
- Sender: news@cs.mu.OZ.AU (CS-Usenet)
- Organization: Infosoft Inc., Cupertino, CA, USA
- References: <20c.32169.607@newage.com.ar> <4bsnbu$5mu@mujibur.inmind.com> <30EDC013.7C780E5E@cims.nyu.edu>
- X-Original-Date: Fri, 12 Jan 1996 02: 03:49 GMT
- Date: Fri, 12 Jan 1996 03:58:32 GMT
- Approved: fjh@cs.mu.oz.au
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBFAgUBMPXceOEDnX0m9pzZAQEYkQF9GMT9Br8Ri008HowMw3389GFa1XSEbtRl
- 14CQjOfZ9ZoP/fwM1yJaotwHmTMfk6nX
- =aysm
-
- > I certainly hope not! Name mangling is a solution to passing type
- > information to 1950's linkers. Once linkers become more sophisticated,
- > name mangling can disappear back into the slime from which it came.
-
- I beg to differ. Name mangling serves several indispensible functions:
-
- 1. It makes it possible to have more than one function with the same name
- (differing in their argument lists). To do this without mangling, the linker
- would have to see not just a function name, or even class::name, but a full
- _prototype_ for each function (omitting variable names and the result type).
-
- 2. It allows the linker to do error checking. Example: Module A calls
- foo() in module B. I change the definition of foo (and its argument list)
- but forget to change A. Without name mangling, the program will simply crash
- (or do strange things because I've clobbered the stack...)
-
- On systems like the PC, with multiple pointer formats, this could also be
- used to check that all modules (including library code) were compiled with
- the same (or compatible) memory model. I think it is really stupid that none
- of the compilers for the PC makes this possible by including the memory model
- in mangled names.
-
- 3. When linking with other languages such as Pascal, it in effect checks that
- you told the C++ compiler to use the calling sequence for the language that
- the function you're calling is in.
-
- In short, wanting to eliminate name mangling is like wanting a compiler that
- never prints error messages. It's for people who would rather walk off a
- cliff than have someone tell them they're about to.
-
- For the same reason, I'm against the concept of "undefined behavior" in the C
- and C++ standards. No program that has "undefined behavior" should compile.
- --
- John David Galt I do not speak for my employer.
- jgalt@infosoft.com Send personal mail to: John_David_Galt@cup.portal.com
- ---
- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
- Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
- is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
-